package front;

import contacts.ContactRoller;
import contacts.ContactElement;
import java.io.*;

public class ContactRollerFront{
//ContactRoller z;
private static String COM_QUIT="-quit", COM_ADD="-add", COM_PRINT="-print", COM_SEARCH="-search";
public static void main(String[] rags) throws IOException{
ContactRoller z=new ContactRoller();
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
String com="";
while(!com.equals(COM_QUIT)){
System.out.print(">>");
com=in.readLine();
if(com.equals(COM_ADD)){
System.out.println("<name>,<address>,<number>");
ContactElement x=new ContactElement(in.readLine(),in.readLine(),in.readLine());
z.addCard(x);
System.out.println("Added");
}
else if(com.equals(COM_PRINT)){
System.out.println(z);
}
else if(com.equals(COM_SEARCH)){
System.out.println("<Search parameter>");
String sp=in.readLine();
ContactRoller found=z.getCards(sp);
System.out.println(found);
}
}
}
}

